package com.wu.project.admin.api;

import com.wu.project.admin.annotations.Authorization;
import com.wu.project.admin.annotations.Log;
import com.wu.project.admin.component.JsonResult;
import com.wu.project.admin.entity.TaskInfoDTO;
import com.wu.project.admin.entity.TaskInfoQueryVO;
import com.wu.project.admin.property.Constants;
import com.wu.project.admin.service.TaskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Sansan
 */
@RestController
@RequestMapping("/TaskInfo")
public class TaskInfoApi {
    @Autowired
    private TaskInfoService taskInfoService;

    @Authorization
    @Log(name = "获取项目管理列表")
    @PostMapping(value = "/TaskInfoList", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult TaskInfoList(@RequestBody TaskInfoQueryVO taskInfoQueryVO){
        return taskInfoService.getTaskInfoList(taskInfoQueryVO);
    }

    @Authorization
    @Log(name = "获取项目管理详情")
    @GetMapping(value = "/TaskInfoOne", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult TaskInfoOne(@RequestParam Long taskInfoId){
        return  taskInfoService.getTaskInfoOne(taskInfoId);
    }

    @Authorization
    @Log(name = "新增项目管理")
    @PostMapping(value = "/TaskInfoAdd", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult TaskInfoAdd(@RequestBody TaskInfoDTO taskInfoDTO){
        return  taskInfoService.addTaskInfo(taskInfoDTO);
    }

    @Authorization
    @Log(name = "修改项目管理")
    @PostMapping(value = "/TaskInfoUpdate", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult TaskInfoUpdate(@RequestBody TaskInfoDTO taskInfoDTO){
        return  taskInfoService.updateTaskInfo(taskInfoDTO);
    }

    @Authorization
    @Log(name = "删除项目管理")
    @PostMapping(value = "/TaskInfoDel", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult TaskInfoDel(@RequestBody TaskInfoDTO taskInfoDTO){
        return  taskInfoService.deleteTaskInfo(taskInfoDTO);
    }

}
